﻿@{
    Layout = null;
    var eid = ViewBag.eid;
}

<script src="~/Scripts/Bootstrap/js/bootstrap-select.js"></script>
<link href="~/Scripts/Bootstrap/css/bootstrap-select.min.css" rel="stylesheet" />
<script src="~/Scripts/MGJJS/Manager/UserManager.js"></script>
 


<div class="mtlr15">
    <div id="SearchForm" >
        <div class="row">
            <div class="col-lg-4 col-md-4 col-sm-4" style="padding:0">
                <button type="button" class="btn btn-success" onclick="$.MGJ.UserManager.Dialog_AddUser()">
                    <i class="glyphicon glyphicon-plus"></i>
                    新增
                </button>
                <button type="button" class="btn btn-success" onclick="$.MGJ.UserManager.Execls('#UserInfo')">
                    <i class="glyphicon glyphicon-share-alt"></i>
                    导出excel
                </button>
            </div>
            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"></div>
                <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
                    <div class="input-group">
                        <div class="input-group-btn" style="margin-left:1px;" onclick="detailSearch(this)">
                            <button type="button" class="btn btn-default" style="background-color: #f3f7f9; color: #76838f; ">
                                公司名称
                            </button>
                        </div>
                        <select id="EnterpriseBox" onchange="$.MGJ.UserManager.Ajax_GetUserInfo(1, $('#whereStr').val(),$(this).val());" class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true" title="--机构名称--"  ></select>
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 col-sm-4">

                    <div class="input-group">

                        <input type="text" class="form-control" id="whereStr" placeholder="用户名称" onkeydown="if (event.keyCode == 13) { $.MGJ.UserManager.Ajax_GetUserInfo(1, $('#whereStr').val(), $('#enterprisebox').val()); }">
                        <span class="input-group-addon" onclick="$.MGJ.UserManager.Ajax_GetUserInfo(1, $('#whereStr').val(),$('#enterprisebox').val());">
                            <span class="glyphicon glyphicon-search"></span>
                        </span>
                    </div>
                </div>
            </div>
    </div>
    <div id="Table">
        <div class="overflow">
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th width="30px"><input class="AllClickCheckbox" type="checkbox"></th>
                        <th>用户名称</th>
                        <th>登录名</th>
                        <th>用户状态</th>
                        <th>手机号</th>
                        <th>备注</th>
                        <th>所属机构</th>
                        <th>角色名称</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="UserInfo" style="display:none;" binding="{'pageId':'ShoppingPager','pageCallback':'$.MGJ.UserManager.Ajax_GetUserInfo','emptyHtml':User_EmptyHtml}">
                    <tr>
                        <td width="15"><input type="checkbox" class="AllClickChild" binding="{'ID':'ID'}"></td>
                        <td binding="{'text':'RealName'}"></td>
                        <td binding="{'text':'LoginName'}"></td>
                        <td binding="{'text':'ViewFlag','textHandle':$.MGJ.UserManager.Bin_ViewFlag}"></td>
                        <td binding="{'text':'Modile',}"></td>
                        <td binding="{'text':'Remark','title':'Remark'}"></td>
                        <td binding="{'text':'EnterpriseName','title':'EnterpriseName'}"></td>
                        <td style="max-width:280px;" binding="{'text':'roleNames','title':'roleNames'}" ,'texthandle':$.mgj.usermanager.ajax_binrolenames}"></td>
                        <td id="oper">
                            <a   binding="{'UserID':'ID','type':'AdminRoleID'}" onclick="$.MGJ.UserManager.Dialog_ResetCode(this)">重置密码</a>
                            <a class="EDRoleType" binding="{'UserID':'ID','type':'AdminRoleID','eName':'EnterpriseName'}" onclick="$.MGJ.UserManager.Dialog_EditUser(this)">编辑</a>
                            <a class="EDRoleType" binding="{'UserID':'ID','EId':'EnterpriseId','type':'AdminRoleID','eName':'EnterpriseName'}" onclick="$.MGJ.UserManager.Dialog_AEditUser(this,@eid)">绑定角色</a>
                            @*<a binding="{'UserID':'ID'}" onclick="$.MGJ.UserManager.Ajax_DelUser(this)">删除</a>*@
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="ShoppingPager"></div>
    </div>



</div>

<script>
    function EnterpriseBox() {
        $.ajax({
            type: "Get",
            url: "/CodeManage/SelEnterpriseBox",
            dataType: "json",
            success: function (data) {
                var $EnterpriseBox = "<option id='0' value='0'>--全部--</option>";
                for (var i = 0; i < data.length ; i++) {
                    $EnterpriseBox += " <option id='" + data[i].ID + "' value='" + data[i].ID + "'>" + data[i].EnterpriseName + "</option>";
                }
                $("#EnterpriseBox").append($EnterpriseBox);
                $('#EnterpriseBox').selectpicker();
            }
        })
    }
    EnterpriseBox()
 
    var ColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.User_EmptyHtml = '<tr><td colspan="' + ColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';
  
    $(function () {
        $.MGJ.UserManager.Ajax_GetUserInfo(1,"",0);
    });
</script>
